{% extends "base.html" %}

{% block content %}
<script language="javascript" src="/static/js/jquery-1.2.1.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="/static/js/jquery-calendar-pack.js" ></script>
<style type="text/css">@import url(/static/css/jquery-calendar.css);</style>
<script language="javascript" type="text/javascript">
$(document).ready(
	function()
	{
    	popUpCal.regional['zh-cn'] = {dateFormat: 'DMY/'};
		popUpCal.setDefaults(popUpCal.regional['zh-cn']);
	    $('#class_start').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
	    $('#class_end').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
		$('#class_date3').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
		$('#class_date4').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
		$('#class_date5').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
		//$('#dateofdefer').calendar({autoPopUp: 'focus',yearRange: '-2:+1'});
		//$('#attoch').calendar({autoPopUp: 'focus',yearRange: '-2:+1'});
		//{%for pcs in pcs_list%}
	    //$('#class_start{{pcs.id}}').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
	    //$('#class_end{{pcs.id}}').calendar({autoPopUp: 'focus',yearRange: '-5:+1'});
	    //$('#dateofdefer{{pcs.id}}').calendar({autoPopUp: 'focus',yearRange: '-2:+1'});
	    //$('#attoch{{pcs.id}}').calendar({autoPopUp: 'focus',yearRange: '-2:+1'});
		//{%endfor%}
	}
);
 function setvalue()
 {
	var a=document.getElementById('v_forv').value; 
	document.getElementById('venue').value=a; 
 }
 function setcheckall(a){
	if($(a).attr("checked")){
		$("[id='checkbox']").attr("checked",'true');//全选
	}
	else{
		$("[id='checkbox']").removeAttr("checked");
	}
}
 </script>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
.saminput{
width:80px;
}
-->
</style>
 <style>
 .list-div {
  width: 96%;
  border: 1px solid #BBDDE5;
}
.list-div table {
  border: 1px solid #BBDDE5;
}
.list-div th {
  line-height: 24px;
  background: #BBDDE5 url("/static/images/th_bg.gif") repeat-x;
  white-space: nowrap;
}

.list-div td {
  line-height: 22px;
}
tr.over td {background:#F4FAFB; 
} 
</style>
</head>

<body>
<div class="tab-div">
    <!-- tab bar -->
    <div id="tabbar-div">
      <p>
        <span class="tab-back"  id="detail-tab"><a href="/v2/edit_student/{{s_obj.id}}/">{%if s_obj.last_name%}{{s_obj.last_name}} , {{s_obj.first_name}}{%else%}{{s_obj.name_ch}}{%endif%} Profile</a></span><span
        class="tab-front"  id="general-tab">{%if s_obj.last_name%}{{s_obj.last_name}} , {{s_obj.first_name}}{%else%}{{s_obj.name_ch}}{%endif%} Program Enrolled</span><span
        class="tab-back" id="mix-tab"><a href="/v2/pay_record/{{s_obj.id}}/">{%if s_obj.last_name%}{{s_obj.last_name}} , {{s_obj.first_name}}{%else%}{{s_obj.name_ch}}{%endif%} Payment Record</a></span>
      </p>
    </div>
</div>	
<form name="saveenrool" method="post" action="/v2/program_enrolled/{{s_obj.id}}/?period=''">
<table width="100%" border="0">
  <tr>
    <td bgcolor="#D1FAFE">Program Enrolled: &nbsp;&nbsp;
      <select name="program_id" id="program_id">
	<option value="">Select Please</option>
	{%for p in p_list%}
	<option value="{{p.id}}" {%if s_obj.program == p%}selected{%endif%}>{{p.name}}</option>
	{%endfor%}
	</select>&nbsp;&nbsp;
	<!--<input type="button" name="addother" id="addother" value=" Add " />-->	</td>
  </tr>
</table>
<table width="100%" border="0" bgcolor="#D1FAFE">
  <tr>
    <td>Timetable start from: &nbsp;&nbsp;<select name="period" id="period" onChange="window.location='/v2/program_enrolled/{{s_obj.id}}/?period='+this.options[this.selectedIndex].value">
	<option value="">Select Please</option>
	{%for pc in ttlist%}
	<option value="{{pc.pci.period}}" {%if pc.pci.period == period%}selected{%endif%}>{{pc.pci.period}}</option>
	{%endfor%}
	</select>&nbsp;&nbsp;	<input type="button" name="addother" id="addother" value=" Print " onClick="javascript:window.print();" style="width:60;height:22;border:1px;display:none;" />
	</td>
  </tr>
</table>

<table width="100%" border="1" cellpadding="1" cellspacing="1" bordercolor="#64D5F0" bgcolor="#D1FAFE">
  <tr  style="background:#66aaff;color:#ffffff;">
    <td><input type="checkbox" name="checkbox2" value="" class="my5" onclick='setcheckall(this)'/>&nbsp;Reference#</td>
    <td>Modules</td>
    <td>C/E</td>
    <!--<td>Course code</td>
    <td>Season</td>
    <td>Year</td>-->

    <!--<td>Class Start Date</td>
    <td>Class End Date</td>-->

    <!--<td>Lecturer</td>
    <td>Textbook</td>
    <td>Venue</td>
    <td>Status</td>
    <td>Date Of Defer / Completed</td>
    <td>Course Material Sent</td>-->
  </tr>
  {%if pcs_list%}
  {%for pcs in pcs_list%}
  <tr>
    <td>
	<input type="checkbox" name="pcid{{pcs.id}}" id="checkbox" value="{{pcs.id}}" />
	<input type="text" name="period{{pcs.id}}" id="period{{pcs.id}}" value="{{pcs.period}}" /></td>
    <td>
		<textarea name="modules{{pcs.id}}" id="modules{{pcs.id}}" cols="45" rows="3">{{pcs.modules}}</textarea>
	</td>
    <td><input type="text" name="core_elective{{pcs.id}}" id="core_elective{{pcs.id}}" value="{{pcs.core_elective}}" /></td>

	<input type="hidden" name="coursecode{{pcs.id}}" id="coursecode{{pcs.id}}" value="{{pcs.coursecode}}"  />
	<input type="hidden" name="season{{pcs.id}}" id="season{{pcs.id}}" value="{{pcs.season}}" />
	<input type="hidden" name="year{{pcs.id}}" id="year{{pcs.id}}" value="{{pcs.year}}"  />
    <!--<td><input type="text" name="coursecode{{pcs.id}}" id="coursecode{{pcs.id}}" value="{{pcs.coursecode}}" class="saminput" /></td>
    <td><input type="text" name="season{{pcs.id}}" id="season{{pcs.id}}" value="{{pcs.season}}" style="width:40px;" /></td>
    <td><input type="text" name="year{{pcs.id}}" id="year{{pcs.id}}" value="{{pcs.year}}" style="width:40px;" /></td>
    <td><input type="text" name="class_start{{pcs.id}}" id="class_start{{pcs.id}}" value="{{pcs.class_start}}" /></td>
    <td><input type="text" name="class_end{{pcs.id}}" id="class_end{{pcs.id}}" value="{{pcs.class_end}}"  /></td>-->

	<input type="hidden" name="lecture{{pcs.id}}" id="lecture{{pcs.id}}" value="{{pcs.lecture}}" />
	<input type="hidden" name="textbook{{pcs.id}}" id="textbook{{pcs.id}}" value="{{pcs.textbook}}" />
	<input type="hidden" name="venue{{pcs.id}}" id="venue{{pcs.id}}" value="{{pcs.venue}}"   />
	<input type="hidden" name="status{{pcs.id}}" id="status{{pcs.id}}" value="Upcoming"  />
	<input type="hidden" name="attoch{{pcs.id}}" id="attoch{{pcs.id}}" value="{{pcs.attoch}}" class="saminput" />

	<input type="hidden" name="class_start{{pcs.id}}" id="class_start{{pcs.id}}" value="{{pcs.class_start|date:'d/m/Y'}}" class="saminput" />
	<input type="hidden" name="class_end{{pcs.id}}" id="class_end{{pcs.id}}" value="{{pcs.class_end|date:'d/m/Y'}}" class="saminput" />

	<input type="hidden" name="class_date3{{pcs.id}}" id="class_date3{{pcs.id}}" value="{{pcs.class_date3|date:'d/m/Y'}}" class="saminput" />
	<input type="hidden" name="class_date4{{pcs.id}}" id="class_date4{{pcs.id}}" value="{{pcs.class_date4|date:'d/m/Y'}}" class="saminput" />
	<input type="hidden" name="class_date5{{pcs.id}}" id="class_date5{{pcs.id}}" value="{{pcs.class_date5|date:'d/m/Y'}}" class="saminput" />
	<!--
    <td><input type="text" name="lecture{{pcs.id}}" id="lecture{{pcs.id}}" value="{{pcs.lecture}}" class="saminput" /></td>
    <td>
	<textarea name="textbook{{pcs.id}}" id="textbook{{pcs.id}}" cols="18" rows="5">{{pcs.textbook}}</textarea>
	</td>
    <td><input type="text" name="venue{{pcs.id}}" id="venue{{pcs.id}}" value="{{pcs.venue}}"  style="width:30px;" /></td>
    <td>
    <select name="status{{pcs.id}}" id="status{{pcs.id}}">
	<option value="Upcoming">Upcoming</option>
	<option value="Waived">Waived</option>
	<option value="Defer">Defer</option>
	<option value="Completed">Completed</option>
	</select>
	</td>
    <td><input type="text" name="dateofdefer{{pcs.id}}" id="dateofdefer{{pcs.id}}" value="" class="saminput" /></td>
    <td><input type="text" name="attoch{{pcs.id}}" id="attoch{{pcs.id}}" value="{{pcs.attoch}}" class="saminput" />
	</td>
	-->
	<input type="hidden" name="dateofdefer{{pcs.id}}" id="dateofdefer{{pcs.id}}" value="" class="saminput" />

  </tr>
  {%endfor%}
  {%else%}
  <!--<tr>
    <td><input type="text" name="period" id="period" value="" /></td>
    <td>
			<textarea name="modules" id="modules" cols="35" rows="3"></textarea>
	</td>
    <td><input type="text" name="core_elective" id="core_elective" value=""  /></td>-->
    <!--<td><input type="text" name="coursecode" id="coursecode" value="" class="saminput" /></td>
    <td><input type="text" name="season" id="season" value="" style="width:40px;" /></td>
    <td><input type="text" name="year" id="year" value="" style="width:40px;" /></td>
    <td><input type="text" name="class_start" id="class_start" value="" /></td>
    <td><input type="text" name="class_end" id="class_end" value=""  /></td>-->
	<!--
    <td><input type="text" name="lecture" id="lecture" value="" class="saminput" /></td>
    <td>
		<textarea name="textbook" id="textbook" cols="18" rows="5"></textarea>
	</td>
    <td><input type="text" name="venue" id="venue" value=""  style="width:30px;" /></td>
    <td>
    <select name="status" id="status">
	<option value="Upcoming">Upcoming</option>
	<option value="Waived">Waived</option>
	<option value="Defer">Defer</option>
	<option value="Completed">Completed</option>
	</select>
	</td>
    <td><input type="text" name="dateofdefer" id="dateofdefer" value="" class="saminput" /></td>
    <td><input type="text" name="attoch" id="attoch" value="" class="saminput" /></td>
	-->
	<!--
	<input type="hidden" name="lecture" id="lecture" value="" class="saminput" />
	<input type="hidden" name="textbook" id="textbook" value="" class="saminput" />
	<input type="hidden" name="venue" id="venue" value="" class="saminput" />
	<input type="hidden" name="status" id="status" value="" class="saminput" />
	<input type="hidden" name="dateofdefer" id="dateofdefer" value="" class="saminput" />
	<input type="hidden" name="attoch" id="attoch" value="" class="saminput" />
  </tr>-->

	{%endif%}
  <tr>
    <td colspan="14">
	<input type="hidden" name="pcsid" id="pcsid" value="{{pcsid}}" />
	<input type="submit" name="gosave" value=" Save " /><font color='red'>把Reference#前的复选框勾上为学生选中此课入库</font></td>
  </tr>
</table>
</form>

<table width="100%" border="0">
  <tr  style="background:#66aaff;color:#ffffff;">
    <td>{%if s_obj.name_en%}{{s_obj.name_en}}{%else%}{{s_obj.name_ch}}{%endif%} 's Individual Study Plan</td>
  </tr>
</table>

<table width="100%" border="1" cellpadding="1" cellspacing="1" bordercolor="#64D5F0" bgcolor="#EFFFF9">
  <tr  style="background:#66aaff;color:#ffffff;border-bottom:1px solid #333;">
    <td>Reference#</td>
    <td width="200">Modules</td>
    <td>C/E</td>
    <!--<td>Course code</td>
    <td>Season</td>
    <td>Year</td>-->
    <td width="130">Class Date </td>
    <td>Lecture</td>
    <td style="display:none;">Textbook</td>
    <td>Venue</td>
    <td>Status</td>
    <td>Date Of Defer / Completed</td>
    <td>Course Material Sent</td>
    <td>Options</td>
  </tr>
{%for spc in spc_list%}
  <tr style="background:#66aaff;color:#ffffff;border-bottom:1px solid #333;">
    <td>{{spc.pci.period}}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.modules}}{%else%}{{spc.pci.modules}}{%endif%}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.core_elective}}{%else%}{{spc.pci.core_elective}}{%endif%}&nbsp;</td>
    <!--<td>{{spc.coursecode}}</td>
    <td>{{spc.season}}</td>
    <td>{{spc.year}}</td>-->
    <td width="100">
		Day 1: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_start|date:'M d,Y'}}{%else%}{{spc.pci.class_start|date:'M d,Y'}}{%endif%}<br>
		Day 2: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_end|date:'M d,Y'}}{%else%}{{spc.pci.class_end|date:'M d,Y'}}{%endif%}<br>
		{%if spc.pci.class_date3%} Day 3: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date3|date:'M d,Y'}}{%else%}{{spc.pci.class_date3|date:'M d,Y'}}{%endif%}{%endif%}<br>
		{%if spc.pci.class_date4%} Day 4: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date4|date:'M d,Y'}}{%else%}{{spc.pci.class_date4|date:'M d,Y'}}{%endif%}{%endif%}<br>
		{%if spc.pci.class_date5%} Day 5: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date5|date:'M d,Y'}}{%else%}{{spc.pci.class_date5|date:'M d,Y'}}{%endif%}{%endif%}<br>

	</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.lecture}}{%else%}{{spc.pci.lecture}}{%endif%}&nbsp;</td>
    <td style="display:none;">{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.textbook}}{%else%}{{spc.pci.textbook}}{%endif%}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.venue}}{%else%}{{spc.pci.venue}}{%endif%}&nbsp;</td>
    <td>{{spc.pci.status}}&nbsp;{%if spc.pci.status == 'Taiwan'%}<br />{{spc.pci.taiwankemu}}{%endif%}</td>
    <td>{{spc.pci.dateofdefer|date:'M d,Y'}}&nbsp;</td>
    <td align="center">{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.attoch}}{%else%}{{spc.pci.attoch}}{%endif%}&nbsp;</td>
    <td align="center"><a href="/v2/program_enrolled/edit/{{s_obj.id}}/{{spc.pci.id}}/">edit</a><br /> <br /> <a href="/v2/program_enrolled/{{s_obj.id}}/delcourse/{{spc.pci.id}}/?period={{period}}" onclick="return confirm('Are you sure to delete it?');">del</a></td>
  </tr>
  {%endfor%}
  {%if spcpass_list%}
		<tr style="line-height:10px;background:#0099ff;color:#ffffff;border-bottom:1px solid #333;">
		<td {%if isnotsdf == '1'%}colspan="11" {%else%}colspan="11"{%endif%} >&nbsp;</td>
		</tr>
		{%for spc in spcpass_list%}
		  <tr style="border-bottom:1px solid #333;">
    <td>{{spc.pci.period}}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.modules}}{%else%}{{spc.pci.modules}}{%endif%}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.core_elective}}{%else%}{{spc.pci.core_elective}}{%endif%}&nbsp;</td>
    <!--<td>{{spc.coursecode}}</td>
    <td>{{spc.season}}</td>
    <td>{{spc.year}}</td>-->
    <td width="100">Day 1: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_start|date:'M d,Y'}}{%else%}{{spc.pci.class_start|date:'M d,Y'}}{%endif%}<br>
    Day 2: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_end|date:'M d,Y'}}{%else%}{{spc.pci.class_end|date:'M d,Y'}}{%endif%}<br>
	{%if spc.pci.class_date3%} Day 3: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date3|date:'M d,Y'}}{%else%}{{spc.pci.class_date3|date:'M d,Y'}}{%endif%}{%endif%}<br>
	{%if spc.pci.class_date4%} Day 4: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date4|date:'M d,Y'}}{%else%}{{spc.pci.class_date4|date:'M d,Y'}}{%endif%}{%endif%}<br>
	{%if spc.pci.class_date5%} Day 5: {%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.class_date5|date:'M d,Y'}}{%else%}{{spc.pci.class_date5|date:'M d,Y'}}{%endif%}{%endif%}<br>

	</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.lecture}}{%else%}{{spc.pci.lecture}}{%endif%}&nbsp;</td>
    <td style="display:none;">{%if spc.pci.get_pci_obj%}{{spc.textbook}}{%else%}{{spc.textbook}}{%endif%}&nbsp;</td>
    <td>{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.venue}}{%else%}{{spc.pci.venue}}{%endif%}&nbsp;</td>
    <td>{{spc.pci.status}}&nbsp;{%if spc.pci.status == 'Taiwan'%}<br />{{spc.pci.taiwankemu}}{%endif%}</td>
    <td>{{spc.pci.dateofdefer|date:'M d,Y'}}&nbsp;</td>
    <td align="center">{%if spc.pci.get_pci_obj%}{{spc.pci.get_pci_obj.attoch}}{%else%}{{spc.pci.attoch}}{%endif%}&nbsp;</td>
			<td align="center"><a href="/v2/program_enrolled/edit/{{s_obj.id}}/{{spc.pci.id}}/">edit</a><br /> <br /> <a href="/v2/program_enrolled/{{s_obj.id}}/delcourse/{{spc.pci.id}}/?period={{period}}" onclick="return confirm('Are you sure to delete it?');">del</a></td>
		  </tr>
		  {%endfor%}
  {%endif%}
  </table>
  {{ttt}}
{% endblock %}
